package com.genexususa.eo.bing.test.resume;

import com.genexususa.eo.bing.connection.SitePlacementManager;
import com.genexususa.eo.bing.test.TestUtil;

public class ConsumeResumeSitePlacements {
    public static void main(String[] args) {
        TestUtil testUtil = new TestUtil();
        String sitePlacementsRequestsXML =  "<Bing_SitePlacementsRequestCollection xmlns=\"L2TMediaDev\">\n" +
                                                "\t<Bing_SitePlacementsRequest xmlns=\"L2TMediaDev\">\n" +
                                                    "\t\t<GxCampaignId>45616011</GxCampaignId>\n" +
                                                    "\t\t<BingCampaignId>" + testUtil.campaignId1 +"</BingCampaignId>\n" +
                                                    "\t\t<SitePlacementsAdGroupRequestCollection>\n" +
                                                        "\t\t\t<SitePlacementsAdGroupRequest>\n" +
                                                            "\t\t\t\t<GxAdGroupId>452315612</GxAdGroupId>\n" +
                                                            "\t\t\t\t<BingAdGroupId>" + testUtil.adGroup11 + "</BingAdGroupId>\n" +
                                                            "\t\t\t\t<SitePlacementCollection>\n" +
                                                                "\t\t\t\t\t<SitePlacement>\n" +
                                                                    "\t\t\t\t\t\t<GxSitePlacementId xmlns=\"https://adcenter.microsoft.com/v8\">640894056122</GxSitePlacementId>\n" +
                                                                    "\t\t\t\t\t\t<BingSitePlacementId xmlns=\"https://adcenter.microsoft.com/v8\">" + testUtil.sitePlacementId111 + "</BingSitePlacementId>\n" +
                                                                    "\t\t\t\t\t\t<Status>" + testUtil.sitePlacementStatus.get("active") + "</Status>\n" +
                                                                "\t\t\t\t\t</SitePlacement>\n" +
                                                                "\t\t\t\t\t<SitePlacement>\n" +
                                                                    "\t\t\t\t\t\t<GxSitePlacementId xmlns=\"https://adcenter.microsoft.com/v8\">640894056123</GxSitePlacementId>\n" +
                                                                    "\t\t\t\t\t\t<BingSitePlacementId xmlns=\"https://adcenter.microsoft.com/v8\">" + testUtil.sitePlacementId112 + "</BingSitePlacementId>\n" +
                                                                    "\t\t\t\t\t\t<Status>" + testUtil.sitePlacementStatus.get("active") + "</Status>\n" +
                                                                "\t\t\t\t\t</SitePlacement>\n" +
                                                            "\t\t\t\t</SitePlacementCollection>\n" +
                                                        "\t\t\t</SitePlacementsAdGroupRequest>\n" +
                                                    "\t\t</SitePlacementsAdGroupRequestCollection>\n" +
                                                "\t</Bing_SitePlacementsRequest>\n" +
                                                "\t<Bing_SitePlacementsRequest xmlns=\"L2TMediaDev\">\n" +
                                                    "\t\t<GxCampaignId>45616012</GxCampaignId>\n" +
                                                    "\t\t<BingCampaignId>" + testUtil.campaignId2 +"</BingCampaignId>\n" +
                                                    "\t\t<SitePlacementsAdGroupRequestCollection>\n" +
                                                        "\t\t\t<SitePlacementsAdGroupRequest>\n" +
                                                            "\t\t\t\t<GxAdGroupId>452315613</GxAdGroupId>\n" +
                                                            "\t\t\t\t<BingAdGroupId>" + testUtil.adGroup21 + "</BingAdGroupId>\n" +
                                                            "\t\t\t\t<SitePlacementCollection>\n" +
                                                                "\t\t\t\t\t<SitePlacement>\n" +
                                                                "\t\t\t\t\t\t<GxSitePlacementId xmlns=\"https://adcenter.microsoft.com/v8\">640894056124</GxSitePlacementId>\n" +
                                                                "\t\t\t\t\t\t<BingSitePlacementId xmlns=\"https://adcenter.microsoft.com/v8\">" + testUtil.sitePlacementId211 + "</BingSitePlacementId>\n" +
                                                                "\t\t\t\t\t\t<Status>" + testUtil.sitePlacementStatus.get("active") + "</Status>\n" +
                                                                "\t\t\t\t\t</SitePlacement>\n" +
                                                            "\t\t\t\t</SitePlacementCollection>\n" +
                                                        "\t\t\t</SitePlacementsAdGroupRequest>\n" +
                                                        "\t\t\t<SitePlacementsAdGroupRequest>\n" +
                                                            "\t\t\t\t<GxAdGroupId>452315614</GxAdGroupId>\n" +
                                                            "\t\t\t\t<BingAdGroupId>" + testUtil.adGroup22 + "</BingAdGroupId>\n" +
                                                            "\t\t\t\t<SitePlacementCollection>\n" +
                                                                "\t\t\t\t\t<SitePlacement>\n" +
                                                                "\t\t\t\t\t\t<GxSitePlacementId xmlns=\"https://adcenter.microsoft.com/v8\">640894056125</GxSitePlacementId>\n" +
                                                                "\t\t\t\t\t\t<BingSitePlacementId xmlns=\"https://adcenter.microsoft.com/v8\">" + testUtil.sitePlacementId221 + "</BingSitePlacementId>\n" +
                                                                "\t\t\t\t\t\t<Status>" + testUtil.sitePlacementStatus.get("active") + "</Status>\n" +
                                                            "\t\t\t\t\t</SitePlacement>\n" +
                                                        "\t\t\t\t</SitePlacementCollection>\n" +
                                                        "\t\t\t</SitePlacementsAdGroupRequest>\n" +
                                                    "\t\t</SitePlacementsAdGroupRequestCollection>\n" +
                                                "\t</Bing_SitePlacementsRequest>\n" +
                                            "</Bing_SitePlacementsRequestCollection>\n";
        SitePlacementManager resource = new SitePlacementManager();
        System.out.println("Consuming ResumeSitePlacements.....");
        String userName = testUtil.userName;
        String password = testUtil.password;
        String developerToken = testUtil.developerToken;
        long customerId = testUtil.customerId;
        long customerAccountId = testUtil.customerAccountId;
        String applicationId = testUtil.applicationId;
        //String result = resource.resumeSitePlacements(userName, password, developerToken, customerId, customerAccountId, applicationId, sitePlacementsRequestsXML);
        String result = resource.updateSitePlacements(customerAccountId, sitePlacementsRequestsXML);
        System.out.println("Result:\n" + result);
    }
}
